{extend name="public:base" /}
{block name="head"}
<link href="__PUBLIC__/view_res/mobile/css/wshop_companyreg.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/lib/weui.min.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/css/jquery-weui.min.css" type="text/css" rel="Stylesheet" />
<script src="__PUBLIC__/jquery-weui/dist/js/jquery-weui.min.js"></script>
{/block} 

{block name="header"}
{include file="public/top-nav" /}
{/block}

{block name="content"}   
{if condition="isset($apply_result)"}	
	{if condition="$apply_result['status'] EQ 2 "}
	<div style="margin:5px 0;padding:0px 8px; line-height: 20px;color:red;">
	由于您提交的资料中,{$apply_result.answer}，审核没有通过，请修改后在提交申请。
	</div>	
	{/if}
{/if}
<!-- from -->
<form id="login-wrap">
    <header class="Thead">手机号</header>
    
    {if condition="isset($apply_result)"}
    	<input type="hidden" name="aa_id" value="{$apply_result.aa_id}" />
    {/if}
    
    <div style="padding:0 10px;">
        <div class="gs-text">
            <input type="tel" name="tel" value="{$apply_result.tel|default=''}" tabindex="1" placeholder="手机号" />
        </div>
    </div>

    <header class="Thead">真实姓名</header>
    <div style="margin:0 10px;">
        <div class="gs-text">
            <input type="text" name="name" value="{$apply_result.name|default=''}"  tabindex="2" placeholder="真实姓名" />
        </div>
    </div>

    <header class="Thead">电子邮箱</header>
    <div style="padding:0 10px;">
        <div class="gs-text">
            <input type="text" name="email" value="{$apply_result.email|default=''}"  tabindex="3" placeholder="电子邮箱" />
        </div>
    </div>

    <header class="Thead">身份证号</header>
    <div style="padding:0 10px;">
        <div class="gs-text">
            <input type="text" name="id_cart" value="{$apply_result.id_cart|default=''}" tabindex="4" placeholder="身份证号" />
        </div>
    </div>
</form>

<a class="button green" href="javascript:;" id="reg-btn">提交申请</a>


{/block}
{block name="script"}
<script>
$('#reg-btn').click(function(){
	$.post(
		
		<?php if(isset($apply_result)){ ?>
			'{:url("Agent/edit_apply_agent")}',
		<?php }else{ ?>
			'{:url("Agent/apply_agent")}',	
		<?php } ?>
		
		$('input[type="tel"],input[type="text"],input[type="hidden"]'),
		function(d){
			if(d.error){
				$.toast(d.error, "forbidden");
			}else if(d.success){
				$.toast(d.success);
				
				setTimeout(function (){
			      history.go(-1);
			    },2000);
			}
		}
	);
});
</script>
{/block}